// Save data in Data memory
//
// Assembler test - save results from operations in Data memory
// U M.H.
// 01/12/21
//
LIL R0, 0      // Set R0 to the address of the switches (0xC000)
LIU R0, 0x38   
LIL R1, 0      // Set R1 to the Address of the LEDs (0xC200)
LIU R1, 0x08 
LIU R1, 0x38

LIL R3, 0      // Set R3 to the address of the data memory (0x0000)
LIL R4, 1      // Set R4 to the address of the data memory (0x0001)
LIL R5, 2      // Set R3 to the address of the data memory (0x0002)


LOAD R2,(R0)   	// Get the switch values to R2 - Load instructions must be done twice
LOAD R2,(R0)

STORE (R1), R2	// Set value of switches to LEDs
STORE (R3), R2	// Set the contents of Data memory (0x0000) to the switch values

LIL R6, 0x07	// Load immediate value 7
STORE (R4), R6	// Set the contents of Data memory (0x0001) to 0x07
MOVE R8, R6		// Copy contents of R6 to R8
ADC R8, R2		// Add R8 = R8 + R2
STORE (R5), R8	// Set contents of Data memory (0x0002) to R8
